#include "GapStateBase.h"
#include "GapGenerator.h"

namespace tsc
{
namespace sgw
{

/*******************************************************************************
 *
 * Constructor
 *
 ******************************************************************************/
GapStateBase::GapStateBase(const char* name) :
    StateBase(name)
{

} // GapStateBase::GapStateBase

/*******************************************************************************
 *
 * Destructor
 *
 ******************************************************************************/
GapStateBase::~GapStateBase()
{

} // GapStateBase::~GapStateBase


//===================================================================
bool
GapStateBase::txEnabled() const
{
    return false;
}

//===================================================================
void
GapStateBase::handleEvent(
    common::Generator*  generator,
    common::EventData*& eventData)
{
    if (!eventData)
    {
        return;
    }

    switch (eventData->sigNo())
    {
    case GAP_CONNECTION_IND:
    {
        handleEventGapConnectionInd(
            static_cast<GapGenerator*>(generator),
            static_cast<GapEventConnectionInd*>(eventData),
            eventData);
    }
    break;

    case GAP_T823_EXPIRED:
    {
        handleEventGapT823Expired(
            static_cast<GapGenerator*>(generator),
            static_cast<GapEventT823Expired*>(eventData),
            eventData);
    }
    break;

    case GAP_T8221_EXPIRED:
    {
        handleEventGapT8221Expired(
            static_cast<GapGenerator*>(generator),
            static_cast<GapEventT8221Expired*>(eventData),
            eventData);
    }
    break;

    case GAP_MEDIA_TRANSMISSION_END:
    {
        handleEventGapMediaTransmissionFinishedInd(
            static_cast<GapGenerator*>(generator),
            static_cast<GapEventMediaTransmissionFinishedInd*>(eventData),
            eventData);
    }
    break;

    case GAP_MEDIA_BEARER_SETUP_CFM:
    {
        handleEventGapMediaBearerSetupCfm(
            static_cast<GapGenerator*>(generator),
            static_cast<GapEventMediaBearerSetupCfm*>(eventData),
            eventData);
    }
    break;

    case GAP_MEDIA_BEARER_SETUP_REJ:
    {
        handleEventGapMediaBearerSetupRej(
            static_cast<GapGenerator*>(generator),
            static_cast<GapEventMediaBearerSetupRej*>(eventData),
            eventData);
    }
    break;

    default:
        // TODO - print error
        EventData::deleteEvent(eventData);
    }
}

//===================================================================
void
GapStateBase::handleEventGapConnectionInd(
    GapGenerator*           gapGen,
    GapEventConnectionInd* event,
    EventData*& eventData)
{
    // TODO logging
    EventData::deleteEvent(eventData);
}

//===================================================================
void
GapStateBase::handleEventGapT823Expired(
    GapGenerator* gapGen,
    GapEventT823Expired* event,
    EventData*& eventData)
{
    // TODO logging
    EventData::deleteEvent(eventData);
}

//===================================================================
void
GapStateBase::handleEventGapT8221Expired(
    GapGenerator* gapGen,
    GapEventT8221Expired* event,
    EventData*& eventData)
{
    // TODO logging
    EventData::deleteEvent(eventData);
}

//===================================================================
void
GapStateBase::handleEventGapEchoResponse(
    GapGenerator* gapGen,
    GapEventEchoResp* event,
    EventData*& eventData)
{
    // TODO logging
    EventData::deleteEvent(eventData);
}

//===================================================================
void
GapStateBase::handleEventGapMediaTransmissionFinishedInd(
    GapGenerator* gapGen,
    GapEventMediaTransmissionFinishedInd* event,
    EventData*& eventData)
{
    // TODO logging
    EventData::deleteEvent(eventData);
}

//===================================================================
void
GapStateBase::handleEventGapMediaBearerSetupCfm(
    GapGenerator* gapGen,
    GapEventMediaBearerSetupCfm* event,
    EventData*& eventData)
{
    // TODO logging
    EventData::deleteEvent(eventData);
}

//===================================================================
void
GapStateBase::handleEventGapMediaBearerSetupRej(
    GapGenerator* gapGen,
    GapEventMediaBearerSetupRej* event,
    EventData*& eventData)
{
    // TODO logging
    EventData::deleteEvent(eventData);
}

} // namespace sgw
} // namespace tsc
